#!/usr/bin/env python
# -*- encoding: utf-8 -*-

'''
@File    :   tree_classify.py  
@Version : 1.0  
@Author :   iherr
@Desciption : 测试决策树分类
'''

import trees

def retrieveTree(i):
    listOfTrees =[{'no surfacing': {0: 'no', 1: {'flippers': {0: 'no', 1: 'yes'}}}},
                  {'no surfacing': {0: 'no', 1: {'flippers': {0: {'head': {0: 'no', 1: 'yes'}}, 1: 'no'}}}}
                  ]
    return listOfTrees[i]

result=trees.classify(retrieveTree(0),['no surfacing', 'flippers'],[1,0])
trees.storeTree(retrieveTree(0),'tree.txt')
print(result)

print(trees.grabTree('tree.txt'))